package com.assessment.servermanager.controller;


import javax.servlet.http.HttpServletResponse;

import com.assessment.servermanager.commen.controller.BaseController;
import com.assessment.servermanager.commen.entity.AjaxResult;
import com.assessment.servermanager.commen.entity.PageQuery;
import com.assessment.servermanager.commen.page.TableDataInfo;
import com.assessment.servermanager.entity.TbEmployee;
import com.assessment.servermanager.entity.bo.TbEmployeeBo;
import com.assessment.servermanager.entity.vo.TbEmployeeVo;
import com.assessment.servermanager.service.ITbEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 【请填写功能名称】Controller
 *
 * @author jiajia
 * @date 2023-08-28
 */
@RestController
@RequestMapping("/employee")
public class TbEmployeeController extends BaseController {
    @Autowired
    private ITbEmployeeService tbEmployeeService;

    /**
     * 查询【请填写功能名称】列表
     */
    @GetMapping("/list")
    public TableDataInfo<TbEmployeeVo> list(TbEmployeeBo employeeQC, PageQuery pageQuery) {
        return tbEmployeeService.selectTbEmployeeList(employeeQC,pageQuery);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbEmployee tbEmployee) {
       /* List<TbEmployee> list = tbEmployeeService.selectTbEmployeeList(tbEmployee);
        ExcelUtil<TbEmployee> util = new ExcelUtil<TbEmployee>(TbEmployee.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");*/
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(tbEmployeeService.selectTbEmployeeById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PostMapping
    public AjaxResult add(@RequestBody TbEmployee tbEmployee) {
        return toAjax(tbEmployeeService.insertTbEmployee(tbEmployee));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TbEmployee tbEmployee) {
        return toAjax(tbEmployeeService.updateTbEmployee(tbEmployee));
    }

    /**
     * 删除【请填写功能名称】
     */
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(tbEmployeeService.deleteTbEmployeeByIds(ids));
    }
}
